package com.caishi.lkx.order.model;

import com.baomidou.mybatisplus.annotation.TableName;
import com.zzw.common.entity.impl.BaseEntity;
import com.caishi.lkx.order.ienum.type.PaymentType;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;

import java.math.BigDecimal;

/**
 * @author by keray
 * date:2019/9/10 14:33
 */
@EqualsAndHashCode(callSuper = true)
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@Schema(title = "交易支付退款记录", description = "交易支付退款记录")
@TableName("sys_payment_refund_log")
public class PaymentRefundLogModel extends BaseEntity<PaymentRefundLogModel> {
    /**
     * 退款方式
     */
    private PaymentType refundType;

    /**
     * 交易id {@link PaymentModel#getId()}
     */
    private String paymentId;


    private String orderId;

    /**
     * 退款金额
     */
    private Long refundAmount;

    /**
     * 用户id
     */
    private String userId;


    public BigDecimal getRefundAmountBigDecimal() {
        if (this.getRefundAmount() == null) {
            return BigDecimal.ZERO;
        }
        return BigDecimal.valueOf(this.getRefundAmount()).divide(BigDecimal.valueOf(100));
    }
}
